package com.demo.point;

import lombok.extern.java.Log;
import org.springframework.core.LocalVariableTableParameterNameDiscoverer;

import java.lang.reflect.Method;

@Log
public class GetMethArguments {

	private static final LocalVariableTableParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer();

	public void testArguments(String test, Integer myInteger, boolean booleanTest) {
	}

	public void test() {

	}

	public static void main(String[] args) {
		Method[] methods = GetMethArguments.class.getMethods();
		for (Method method : methods) {
			String[] paraNames = parameterNameDiscoverer.getParameterNames(method);

			log.info("methodName:" + method.getName());
			if (paraNames != null) {
				StringBuffer buffer = new StringBuffer();
				for (String string : paraNames) {
					buffer.append(string).append("\t");
				}
				log.info("parameArguments:" + buffer);
			} else {
				log.info("无参数");
			}
		}
	}
}